import { ApiProperty } from '@nestjs/swagger';
import { Entity, Index, Column, ManyToOne, JoinColumn } from "typeorm";
import { CommonEntity } from "~/common/entity/common.entity";
import { CategoryEntity } from '~/modules/category/category.entity';
import { UserEntity } from '~/modules/user/user.entity';

@Entity({ name: 'ah_category_disease' })
@Index(['id'])
export class CategoryDiseaseEntity extends CommonEntity {
    @ApiProperty({ description: '关联说明' })
    @Column({ type: 'varchar', length: 200, nullable: true, comment: '关联说明' })
    remark: string;

    @ManyToOne(() => CategoryEntity)
    @JoinColumn({ name: 'category_id' })
    category: CategoryEntity;

    @ManyToOne(() => UserEntity)
    @JoinColumn({ name: 'user_id' })
    user: UserEntity;
}